package com.weixin.paleituo.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.weixin.paleituo.bean.ClassifyBean;
import com.weixin.paleituo.fragment.ClassifyBrandFragment;

import java.util.List;

/**
 * Author yichao
 * Time  2018/4/1 10:44
 * Dest 分类
 */
public class ClassifyPagerAdapter extends FragmentPagerAdapter {
    private List<ClassifyBean> mClassifyBeanList;
    public ClassifyPagerAdapter(FragmentManager fm, List<ClassifyBean> classifyBeanList) {
        super(fm);

        mClassifyBeanList = classifyBeanList;
    }
    @Override
    public Fragment getItem(int position) {
       // return ClassGoodsFragmentFactory.getFragment(position,mClassifyBeanList.get(position));
        return  ClassifyBrandFragment.getInstance(mClassifyBeanList.get(position));
    }
    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mClassifyBeanList.get(position%mClassifyBeanList.size()).getName();
    }

    @Override
    public int getCount() {
        return mClassifyBeanList.size();
    }
}
